package com.learn.project2.mapper;

import com.learn.project2.bean.MarketCart;
import com.learn.project2.bean.MarketCartExample;

import java.sql.Timestamp;
import java.util.List;

import net.sf.jsqlparser.expression.DateTimeLiteralExpression;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import org.yaml.snakeyaml.error.Mark;

@Mapper
@Repository
public interface MarketCartMapper {
    long countByExample(MarketCartExample example);

    int deleteByExample(MarketCartExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(MarketCart record);

    int insertSelective(MarketCart record);

    List<MarketCart> selectByExample(MarketCartExample example);

    MarketCart selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") MarketCart record, @Param("example") MarketCartExample example);

    int updateByExample(@Param("record") MarketCart record, @Param("example") MarketCartExample example);

    int updateByPrimaryKeySelective(MarketCart record);

    int updateByPrimaryKey(MarketCart record);

    // 统计 才需要判断是否deleted = 0
    Integer selectCountsByUserId(Integer id);

    // 其余改变更新，若不为0，不会遍历到。
    Integer updateByProductIdAndUserId(@Param("isChecked") Integer isChecked, @Param("productId") Integer productId, @Param("userId") int userId, @Param("timestamp") Timestamp timestamp);

    void updateDeletedByProductIdAndUserId(@Param("productId") Integer productId, @Param("userId") int userId);

    void updateNumber(@Param("id") Integer id, @Param("number") Integer number);

}